﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MEF_Test.Bricks.Mediator
{
    public class Mediator<T> where T : IMediatorEvent
    {
        static private List<Action<T>> _callbacks = new List< Action<T>>();
        static public void Publish(T mediatorEvent)
        {
            foreach (var item in _callbacks)
            {
                item(mediatorEvent);
            }
        }
        static public void Register( Action<T> callback)
        {
            _callbacks.Add( callback);
        }
    }
}
